.class public Lcom/zuiapps/suite/utils/ui/CustomButton;
.super Landroid/widget/RelativeLayout;
.source "CustomButton.java"


# instance fields
.field private background:I

.field private image:I

.field private imgid:I

.field private text:Ljava/lang/String;

.field private textid:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    const/4 v0, -0x1

    .line 50
    invoke-direct {p0, p1}, Landroid/widget/RelativeLayout;-><init>(Landroid/content/Context;)V

    .line 17
    iput v0, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->image:I

    .line 18
    iput v0, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->background:I

    .line 19
    iput v0, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->textid:I

    .line 20
    iput v0, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->imgid:I

    .line 51
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .registers 9
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;

    .prologue
    const/4 v3, -0x1

    const/4 v5, 0x0

    const/4 v4, 0x0

    .line 23
    invoke-direct {p0, p1, p2}, Landroid/widget/RelativeLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 17
    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->image:I

    .line 18
    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->background:I

    .line 19
    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->textid:I

    .line 20
    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->imgid:I

    .line 25
    const/4 v2, -0x1

    .line 26
    .local v2, "resourceText":I
    const-string v3, "TextID"

    invoke-interface {p2, v5, v3, v4}, Landroid/util/AttributeSet;->getAttributeResourceValue(Ljava/lang/String;Ljava/lang/String;I)I

    move-result v3

    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->textid:I

    .line 27
    const-string v3, "ImageID"

    invoke-interface {p2, v5, v3, v4}, Landroid/util/AttributeSet;->getAttributeResourceValue(Ljava/lang/String;Ljava/lang/String;I)I

    move-result v3

    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->imgid:I

    .line 28
    new-instance v1, Landroid/widget/TextView;

    invoke-direct {v1, p1}, Landroid/widget/TextView;-><init>(Landroid/content/Context;)V

    .line 29
    .local v1, "name":Landroid/widget/TextView;
    invoke-direct {p0, v1}, Lcom/zuiapps/suite/utils/ui/CustomButton;->initTextView(Landroid/widget/TextView;)V

    .line 30
    new-instance v0, Landroid/widget/ImageView;

    invoke-direct {v0, p1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    .line 31
    .local v0, "img":Landroid/widget/ImageView;
    invoke-direct {p0, v0}, Lcom/zuiapps/suite/utils/ui/CustomButton;->initImageView(Landroid/widget/ImageView;)V

    .line 32
    const-string v3, "Text"

    invoke-interface {p2, v5, v3, v4}, Landroid/util/AttributeSet;->getAttributeResourceValue(Ljava/lang/String;Ljava/lang/String;I)I

    move-result v2

    .line 33
    if-lez v2, :cond_46

    .line 34
    invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v3

    invoke-virtual {v3, v2}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->text:Ljava/lang/String;

    .line 35
    iget-object v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->text:Ljava/lang/String;

    invoke-virtual {v1, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 37
    :cond_46
    const-string v3, "Image"

    invoke-interface {p2, v5, v3, v4}, Landroid/util/AttributeSet;->getAttributeResourceValue(Ljava/lang/String;Ljava/lang/String;I)I

    move-result v3

    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->image:I

    .line 38
    iget v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->image:I

    if-lez v3, :cond_57

    .line 39
    iget v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->image:I

    invoke-virtual {v0, v3}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 41
    :cond_57
    const-string v3, "Background"

    invoke-interface {p2, v5, v3, v4}, Landroid/util/AttributeSet;->getAttributeResourceValue(Ljava/lang/String;Ljava/lang/String;I)I

    move-result v3

    iput v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->background:I

    .line 42
    iget v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->background:I

    if-lez v3, :cond_68

    .line 43
    iget v3, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->background:I

    invoke-virtual {p0, v3}, Lcom/zuiapps/suite/utils/ui/CustomButton;->setBackgroundResource(I)V

    .line 45
    :cond_68
    invoke-virtual {p0, v1}, Lcom/zuiapps/suite/utils/ui/CustomButton;->addView(Landroid/view/View;)V

    .line 46
    invoke-virtual {p0, v0}, Lcom/zuiapps/suite/utils/ui/CustomButton;->addView(Landroid/view/View;)V

    .line 47
    return-void
.end method

.method private initImageView(Landroid/widget/ImageView;)V
    .registers 6
    .param p1, "img"    # Landroid/widget/ImageView;

    .prologue
    const/4 v3, -0x1

    const/4 v2, 0x3

    .line 65
    iget v1, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->imgid:I

    invoke-virtual {p1, v1}, Landroid/widget/ImageView;->setId(I)V

    .line 66
    invoke-virtual {p1, v2, v2, v2, v2}, Landroid/widget/ImageView;->setPadding(IIII)V

    .line 67
    sget-object v1, Landroid/widget/ImageView$ScaleType;->FIT_CENTER:Landroid/widget/ImageView$ScaleType;

    invoke-virtual {p1, v1}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V

    .line 68
    const/4 v1, 0x1

    invoke-virtual {p1, v1}, Landroid/widget/ImageView;->setAdjustViewBounds(Z)V

    .line 69
    new-instance v0, Landroid/widget/RelativeLayout$LayoutParams;

    invoke-direct {v0, v3, v3}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    .line 71
    .local v0, "params":Landroid/widget/RelativeLayout$LayoutParams;
    const/4 v1, 0x2

    iget v2, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->textid:I

    invoke-virtual {v0, v1, v2}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(II)V

    .line 72
    invoke-virtual {p1, v0}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 73
    return-void
.end method

.method private initTextView(Landroid/widget/TextView;)V
    .registers 6
    .param p1, "tv"    # Landroid/widget/TextView;

    .prologue
    const/4 v2, -0x2

    .line 54
    const/high16 v1, -0x1000000

    invoke-virtual {p1, v1}, Landroid/widget/TextView;->setTextColor(I)V

    .line 55
    new-instance v0, Landroid/widget/RelativeLayout$LayoutParams;

    invoke-direct {v0, v2, v2}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    .line 56
    .local v0, "params":Landroid/widget/RelativeLayout$LayoutParams;
    const/16 v1, 0xc

    invoke-virtual {v0, v1}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(I)V

    .line 57
    const/16 v1, 0xe

    invoke-virtual {v0, v1}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(I)V

    .line 58
    invoke-virtual {p0}, Lcom/zuiapps/suite/utils/ui/CustomButton;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    sget v2, Lcom/zuiapps/suite/utils/R$color;->black:I

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    invoke-virtual {p1, v1}, Landroid/widget/TextView;->setTextColor(I)V

    .line 59
    const/4 v1, 0x0

    invoke-virtual {p0}, Lcom/zuiapps/suite/utils/ui/CustomButton;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    sget v3, Lcom/zuiapps/suite/utils/R$dimen;->title_text_size:I

    invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I

    move-result v2

    int-to-float v2, v2

    invoke-virtual {p1, v1, v2}, Landroid/widget/TextView;->setTextSize(IF)V

    .line 60
    invoke-virtual {p1, v0}, Landroid/widget/TextView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 61
    iget v1, p0, Lcom/zuiapps/suite/utils/ui/CustomButton;->textid:I

    invoke-virtual {p1, v1}, Landroid/widget/TextView;->setId(I)V

    .line 62
    return-void
.end method
